<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/css/style.css"/>
<script type="text/javascript" src="/static/js/vue2.5.1.js"></script>
<script src="/static/js/axios.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/layer/2.4/layer.js"></script>
<script src="/static/js/jquery.base64.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=60eIAsFrAGFAlSnWv0W8okwv8tngCX93"></script>
<div class="page-container" id="password">
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-member-add">

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户昵称：</label>
                <div class="formControls col-xs-8 col-sm-6">
                    <input type="text" class="input-text" v-model="user_nickname" placeholder="请输入用户昵称"
                           name="user_nickname">
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius"  @click="member_add" value="提交">
                    <input class="btn btn-primary radius" @click="cancle_layer" value="关闭">
                </div>
            </div>

        </form>
    </article>
</div>

<script>
    var app = new Vue({
        el: '#password',
        data: {
            user_nickname: "{$data['user_nickname']}",
            user_id: "{$data['user_id']}",
        },
        created() {

        },
        methods: {
            //注册会员
            member_add: function () {
                if (!this.user_nickname) {
                    layer.alert('用户昵称不能为空')
                    return false;
                }
                axios.post('/admin/User/editUserName',
                    {
                        user_id: this.user_id,
                        user_nickname: this.user_nickname,
                    }
                ).then(response => {
                    if (response.data.status == 200) {
                        window.location = '/admin/User/index';
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    } else {
                        layer.alert(response.data.msg)
                    }
                })
            },
            cancle_layer: function () {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        }
    });
</script>

